package com.ruoyi.depot.mapper;

import java.util.List;
import com.ruoyi.depot.domain.Stocktakes;
import com.ruoyi.depot.domain.vo.AddInventoryTaskVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 盘点任务Mapper接口
 * 
 * @author luxiaoyu
 * @date 2025-01-06
 */
@Mapper
public interface StocktakesMapper 
{
    /**
     * 查询盘点任务
     * 
     * @param stocktakeId 盘点任务主键
     * @return 盘点任务
     */
    public Stocktakes selectStocktakesByStocktakeId(@Param("stocktakeId") String stocktakeId);

    /**
     * 查询盘点任务列表
     * 
     * @param stocktakes 盘点任务
     * @return 盘点任务集合
     */
    public List<Stocktakes> selectStocktakesList(Stocktakes stocktakes);

    /**
     * 新增盘点任务
     * 
     * @param Stocktakes 盘点任务
     * @return 结果
     */
    public int insertStocktakes(Stocktakes Stocktakes);

    /**
     * 修改盘点任务
     * 
     * @param stocktakes 盘点任务
     * @return 结果
     */
    public int updateStocktakes(Stocktakes stocktakes);

    /**
     * 删除盘点任务
     * 
     * @param stocktakeId 盘点任务主键
     * @return 结果
     */
    public int deleteStocktakesByStocktakeId(Long stocktakeId);

    /**
     * 批量删除盘点任务
     * 
     * @param stocktakeIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteStocktakesByStocktakeIds(@Param("list") List<String> stocktakeIds);

    /**
     * 查询盘点单是否存在
     * @param stocktakeId
     * @return
     */
    int selectCount(@Param("stocktakeId") String stocktakeId);


    /**
     * 更新盘点单状态
     * @param stocktakeId
     * @return
     */
    int update(@Param("stocktakeId") String stocktakeId,@Param("status") Integer status);

    /**
     * 判断盘点任务是否已经完成
     * @param stocktakeId
     * @return
     */
    int countUncountedDetails(@Param("stocktakeId") String stocktakeId);

    /**
     * 获取最后一个盘点单号
     * @return
     */
	String selectLastStocktakeNumberForUpdate(@Param("currentDate") String currentDate);

    /**
     * 检查盘点单号是否已经存在
     * @param code
     * @return
     */
    int checkStocktakesNumberExists(@Param("code") String code);

    /**
     * 查询盘点单信息
     * @param stocktakeId
     * @return
     */
    Stocktakes selectByStocktakeId(@Param("stocktakeId") String stocktakeId);
}
